package coder812.User.service;

import coder812.User.dao.UserMapper;
import coder812.User.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by 来自北海的风 on 2017/8/12.
 */
@Service("userServiceImpl")
public class UserServiceImpl implements UserService {

    private UserMapper userMapper;

    @Autowired
    public UserServiceImpl(UserMapper userMapper){
        this.userMapper=userMapper;
    }

    @Override
    public int insertUser(User user) {
        return userMapper.insert(user);
    }

    @Override
    public User selectByUsername(String username) {

        return userMapper.selectByUsername(username);
    }


    @Override
    public User findUserById(long i) {
        return userMapper.selectByPrimaryKey(i);
    }
}
